automate linking

Hello,

What whoul be the best way of having all requirements link back to a parent reqirement within the same document? I know this is not best practice but this is the direction engineering what to go. Eg.

Section 3.2
description
req 1
description
Section 3.2.1
description
req 2
description
req 3
Section 3.2.2
description
req 4
description
req 5
etc.......

I would like to section the parent requirement then run the script that would link req 2-?? to 1 automatically. Any ideas? Anyone willing to share the code?

Thank you,
-Jim
SystemAdmin - Fri Sep 21 12:01:05 EDT 2012

Re: automate linking
SystemAdmin - Fri Sep 21 14:46:52 EDT 2012

Hello,

does my logic look correct?
 

#include <utils/linkops.dxl>
pragma runLim, 0
 
void childObject(Object currObj, Object cobj)
{
    Object childObj
 
    for childObj in all currObj do 
    {
        if (cell childObj || row childObj || isDeleted childObj) continue
 
                int Error = linkErrorNoError 
                if(childObj."_Req Type" "" == "ASW/HW - Both Application Software and Hardware" || childObj."_Req Type" "" == "ASW - Application Software") 
                {
                        Error=createLink_(childObj,"/CNPE - Project/implied by",cobj)
                        if (Error!=linkErrorNoError) {reportLinkError_(childObj,cobj,"/CNPE - Project/implied by","",Error)}
                }
                
                childObject(childObj, cobj)
    }
}
        
Object cobj = current
Object obj = parent(current Object)
 
Folder fol
Module m = current Module
fol = getParentFolder (m)
 
addLinkModuleDescriptor (fol, fullName(m), fullName(m), false, true, "/CNPE - Project/implied by", "")      
setLinkModuleDescriptorsExclusive(fol, module(m), true)
 
childObject(obj,cobj)

Re: automate linking
llandale - Mon Sep 24 13:47:22 EDT 2012

I think you need to define "parent requirement" more precisely. Below, are you saying that Req 1 is the "parent" of all the Req 2, Req 3, Req 4, Req 5? If there were a 3.2.1.1 Req 6, would it have Req 1 as it's parent as well, or Req 2/3 instead?

Which are the parents of which?

Section 3.2    Main Heading
                description of this section
        req 1   Requirement text
Section 3.2.1   Sub Heading
                description of this section
        req 2   Requirement text
        req 3   Requrement Text
Section 3.2.1.1 Sub-Sub Heading
                description of this section
        req 6   Requirement text
Section 3.2.2   Sub Heading
                description of this section
        req 4   Requirement text
        req 5   Requirement text


-Louie